<?php

class person{
    private $name;
    private $age;
    private $sex;


    public function __construct($na,$a,$s){
        $this ->name=$na;
        $this->age=$a;
        $this ->sex=$s;
        $this ->say();
    }
    public function say(){
        echo "我的名字是:{$this->name}.，我的性别是：{$this->age}.，我的性别是：{$this->sex}" ;  }

        public  function __set($name,$value){
        if($name=='age'){
            $this->age=(($value<0)?1:$value);
        }
        $this->name=$value;
        }

}
/*$my = new person();
$my->age='21';

$my->sex='男';
$my->name= '小白';
$my->say();*/
$my=new person('小白','21','男');
$my->say();
$my->age=-40;
$my->say();
